<template>
  <div class="box-counter">
    <div class="title">
      <p>数据统计</p>
      <p class="bg"></p>
    </div>
    <div ref="counterCharts" class="charts" />
  </div>
</template>

<script lang="ts" setup>
import * as echarts from 'echarts'
import { onMounted, ref } from 'vue'

const counterCharts = ref()

onMounted(() => {
  const myCounterChart = echarts.init(counterCharts.value)
  myCounterChart.setOption({
    title: {
      // text: 'Basic Radar Chart',
    },
    legend: {
      show: false,
      data: ['景点', '好感'],
    },
    radar: {
      // shape: 'circle',
      indicator: [
        {
          name: '景点',
          max: 500,
          axisLine: {
            lineStyle: {
              color: '#fff',
            },
          },
        },
        {
          name: '好感',
          max: 500,
          axisLine: {
            lineStyle: {
              color: '#fff',
            },
          },
        },
        {
          name: '满意',
          max: 500,
          axisLine: {
            lineStyle: {
              color: '#fff',
            },
          },
        },
        {
          name: '出行',
          max: 500,
          axisLine: {
            lineStyle: {
              color: '#fff',
            },
          },
        },
        {
          name: '爱好',
          max: 500,
          axisLine: {
            lineStyle: {
              color: '#fff',
            },
          },
        },
        {
          name: '小吃',
          max: 500,
          axisLine: {
            lineStyle: {
              color: '#fff',
            },
          },
        },
      ],
    },
    series: [
      {
        name: 'Budget vs spending',
        type: 'radar',
        data: [
          {
            value: [420, 390, 280, 350, 480, 380],
            name: '景点',
          },
          {
            value: [50, 140, 280, 260, 420, 210],
            name: '好感',
          },
        ],
      },
    ],
  })
})
</script>

<style lang="scss" scoped>
.box-counter {
  background: url('../../images/dataScreen-main-rb.png') no-repeat;
  background-size: 100% 100%;
  margin-bottom: 20px;
  .title {
    margin-left: 10px;
    color: white;
    font-size: 20px;
  }
  .bg {
    width: 68px;
    height: 7px;
    background: url('../../images/dataScreen-title.png') no-repeat;
    background-size: 100% 100%;
    margin-top: 10px;
  }
  .charts {
    height: calc(100% - 50px);
  }
}
</style>
